package com.ruoyi.web.controller.his;

import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.his.domain.vo.WarnMenuItemVo;
import com.ruoyi.system.mapper.HisEngineRuleGroupMapper;
import com.ruoyi.system.service.ISysMenuService;
import com.ruoyi.system.service.ISysRoleService;
import org.jdom.Parent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/his/menu")
public class getRoleAndMenuController {
    @Autowired
    private ISysMenuService menuService;
    @Autowired
    private ISysRoleService iRoleService;
    @Autowired
    private HisEngineRuleGroupMapper HisEngineRuleGroupMapper;
    /**
     * 获取一级菜单
     * @return
     */
    @GetMapping("/getFistMenu")
    public List<SysMenu> getFistMenu(){
        Long userId = SecurityUtils.getUserId();
        List<SysMenu> menus = menuService.selectFirstMenuByUserId(userId);
        return menus;
    }

    /**
     * 获取二级菜单
     * @param parentId
     * @return
     */
    @GetMapping("/getSecondMenu/{parentId}")
    public List<SysMenu> getSecondMenu(@PathVariable Long parentId){
        Long userId = SecurityUtils.getUserId();
        List<SysMenu> menus = menuService.selectSecondMenuByUserId(userId, parentId);
        return menus;
    }
}
